package com.itheima.test21;

public class Student {
    private String name;
    private Integer chineseScore;
    private Integer mathScore;
    private Integer englishScore;

    public Integer getTotalScore(){
        return chineseScore+mathScore+englishScore;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (name != null ? !name.equals(student.name) : student.name != null) return false;
        if (chineseScore != null ? !chineseScore.equals(student.chineseScore) : student.chineseScore != null)
            return false;
        if (mathScore != null ? !mathScore.equals(student.mathScore) : student.mathScore != null) return false;
        return englishScore != null ? englishScore.equals(student.englishScore) : student.englishScore == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (chineseScore != null ? chineseScore.hashCode() : 0);
        result = 31 * result + (mathScore != null ? mathScore.hashCode() : 0);
        result = 31 * result + (englishScore != null ? englishScore.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", chineseScore=" + chineseScore +
                ", mathScore=" + mathScore +
                ", englishScore=" + englishScore +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getChineseScore() {
        return chineseScore;
    }

    public void setChineseScore(Integer chineseScore) {
        this.chineseScore = chineseScore;
    }

    public Integer getMathScore() {
        return mathScore;
    }

    public void setMathScore(Integer mathScore) {
        this.mathScore = mathScore;
    }

    public Integer getEnglishScore() {
        return englishScore;
    }

    public void setEnglishScore(Integer englishScore) {
        this.englishScore = englishScore;
    }

    public Student() {
    }

    public Student(String name, Integer chineseScore, Integer mathScore, Integer englishScore) {
        this.name = name;
        this.chineseScore = chineseScore;
        this.mathScore = mathScore;
        this.englishScore = englishScore;
    }
}
